#! /bin/sh

# gcc test
gcc  -I include -c src/main.c -o bin/main.o
gcc  -I include -c src/hello.c -o bin/hello.o

gcc bin/main.o bin/hello.o -o bin/myhello
bin/myhello

ar rcs lib/libhello.a  bin/hello.o
gcc bin/main.o -Llib -lhello -o bin/myhello2
bin/myhello2





#compile ch01 hello world program

gcc ./src/01intro/hello.c -o ./bin/hello
./bin/hello


#compile ch01 hello world program step by step
gcc -E ./src/01intro/hello.c -o ./bin/hello.i
gcc -S ./bin/hello.i -o ./bin/hello.s
gcc -c ./bin/hello.s -o ./bin/hello.o
gcc ./bin/hello.o -o ./bin/hello2
./bin/hello2


#ch02 p21  test overflow

gcc ./src/02data/testoverflow.c -o ./bin/testoverflow
./bin/testoverflow


# ch02 p44 test casting

gcc -g ./src/02data/testcast.c -o ./bin/testcast
./bin/testcast

# ch03  
gcc -S ./src/03asm/code.c -o ./bin/code.s
gcc -O1 -S ./src/03asm/code.c -o ./bin/codeo1.s
gcc -O1 -c ./src/03asm/code.c -o ./bin/code.o

